class Student(object):
# 用tuple定义允许绑定的属性名称
    __slots__ = ('name', 'age')

s = Student()
s.name = 'TianWa'
s.age = 16
# s.score = 99
# AttributeError: 'Student' object has no attribute 'score'

class GraduateStudent(Student):
    pass

g = GraduateStudent()
g.score = 99
print(g.score)
